You are here: Building the Model: General Elements > General Information > General Information Dialog Box > Execution Time of Initialization and Termination Logic
It is important to understand exactly when initialization and termination logic is executed. When you select Run from the Simulation menu the following things occur in the order listed:
1. Arrays are initialized based upon the defined Import specifications
2. Variables are initialized to the values specified in the Variables Editor.
3. Macros with a run-time interface are set to their user-specified value.
4. The model is loaded into the simulation module. As the model is loaded, any numeric expressions used to define such things as location capacities or number of resource units are evaluated and assigned a numeric value.
5. Initialization logic is performed.
6. Simulation begins. Initial arrivals and downtimes are scheduled and simulation processes begin.
7. Simulation ends.
8. Termination logic is performed.
9. Statistics are compiled.
Logic elements that figure into a model's structure are evaluated only when the model is loaded into the simulation module. Those logic elements are:
• Simulation warm-up hours
• Simulation run hours
• Node capacity
• Length of path segments
• Resource units
• Location capacity
• Queue length
• Conveyor length
• Conveyor speed
For a complete list of when each field is evaluated, see the Appendix A.
Any variables or arrays used in an expression that change any of these logic elements should be initialized in the Variables Editor, Arrays Import, or run-time interface and not in the initialization logic. The model structure cannot change after the model has been loaded into the simulation module. Thus, any variable or array figuring into a location's capacity and initialized in the initialization logic will be initialized too late to affect the location's capacity.
Variables or arrays which do not figure into a location's capacity may be initialized in the Initialization Logic without any problem. A variable initialized in the initialization logic could be used as the "First Time" for an arrival or downtime occurrence. This is true because arrivals and downtime occurrences are simulation events, and all initialization logic occurs before the first simulation event.